222#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main ()
{
    int n = 0;
    int i = 0;
    int j = 0;
    int t = 0;
    while(scanf("%d",&n)!=EOF)
    {
        for(i=0;i<n;i++)
        {
            if(i==0 || i==n-1)
            {
                for(j=0;j<n;j++)
                {
                    printf("* ");
                }
                printf("\n");
            }
            else
            {
                   t = n - 2;
                   printf("* ");
                   while(t)
                   {
                       printf("  ");
                       t--;
                   }
                   printf("* ");
                   printf("\n");
            }
        }
        
    }
    return 0;
}

